if UI then
    Class("BlackEdge",function (BlackEdge)
        function BlackEdge:constructor()
            self.super(0,0,UI.ScreenSize().width,UI.ScreenSize().height);
            self.border = {80,0,80,0};
        end
        function BlackEdge:onLoad()
            self:animate({{table=self.backgroundcolor,key=4,value=0}},400,function()
                print("渐变动画结束");
            end);
        end
        function BlackEdge:close()
            self:animate({{table=self.border,key=1,value=0},{table=self.border,key=3,value=0}},200,function()
                print("黑边动画结束");
            end);
        end
    end,Component);


    -- Frame.mainLayer:add(Editor((UI.ScreenSize().width - 800)/2,UI.ScreenSize().height * 0.2,800,400));
    -- UI.StopPlayerControl(true);
    local blackEdge = BlackEdge();
    local flag = false;

    MainMenu:add({"黑边动画",{
        "开始",function(item)
            if flag == false then
                Frame.mainLayer:add(blackEdge);
                item.name = "停止";
            else
                Frame.mainLayer:remove(blackEdge);
                item.name = "开始";
            end
            flag = not flag;
        end,
        "隐藏黑边",function ()
            blackEdge:close();
        end,
        "重置",function()
            blackEdge.border = {80,0,80,0};
            blackEdge.backgroundcolor = {255,255,255,255};
        end,
    }},1);
end